package ljw.jvmMonitoring;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.apache.log4j.Logger;

/**
 * Hello world!
 *
 */
public class App 
{
	private static Logger logger = Logger.getLogger(App.class);
	
    public static void main( String[] args )
    {
        App app = new App();
        //app.run();
        app.systemTest();
    }
    
    public void run(){
    	Runtime runtime = Runtime.getRuntime();
        logger.info(runtime.availableProcessors());
        try {
        	
			Process process = runtime.exec("ping 221.148.176.30");
			BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream(), "euc-kr"));
			
			String line = "";
			
			while( (line = br.readLine()) != null ){
				//logger.info(line);
				System.out.println(line);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
    }
    
    public void systemTest(){
    	Map<String, String> map = System.getenv();
    	
    	Set<Entry<String, String>> set = map.entrySet();
    	Iterator it = set.iterator();
    	while(it.hasNext())
    		logger.info(it.next());
    }
}
